/* SPDX-License-Identifier: GPL-2.0 */
#ifndef OCFS2_BLOCK_DEV_H
#define OCFS2_BLOCK_DEV_H

#include <linux/fs.h>
#include <linux/blk_types.h>

struct bdev_inode {
	struct block_device bdev;
	struct inode vfs_inode;
};

static inline struct bdev_inode *BDEV_I(struct inode *inode)
{
	return container_of(inode, struct bdev_inode, vfs_inode);
}

/*
 * Most likely _very_ bad one - but then it's hardly critical for small
 * /dev and can be fixed when somebody will need really large one.
 * Keep in mind that it will be fed through icache hash function too.
 */
static inline unsigned long hash(dev_t dev)
{
	return MAJOR(dev)+MINOR(dev);
}

struct block_device *ocfs2_bdget(dev_t dev);

void ocfs2_bdput(struct block_device *bdev);

#endif /* OCFS2_BLOCK_DEV_H */
